import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { h } from "vue";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '报表名称',
    align: 'center',
    dataIndex: 'reportName',
    width: 200
  },
  {
    title: '社区名称',
    align: 'center',
    dataIndex: 'communityId_dictText',
    width: 80
  },
  {
    title: '账期月份',
    align: 'center',
    dataIndex: 'month',
    width: 80
  },
  {
    title: '进度',
    align: 'center',
    dataIndex: 'progress_dictText',
    width: 80,
    slots: { customRender: 'progress_dictText' },
  },
  {
    title: '起始日期',
    align: 'center',
    dataIndex: 'startData',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
    width: 80
  },
  {
    title: '结束日期',
    align: 'center',
    dataIndex: 'endData',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
    width: 80
  },

  {
    title: '创建人',
    align: 'center',
    dataIndex: 'createBy_dictText',
    width: 80
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime',
    width: 80
  },
  {
    title: '推送人',
    align: "center",
    dataIndex: 'pusher',
    width: 80
  },
  {
    title: '推送时间',
    align: "center",
    dataIndex: 'pushData',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
    width: 80
  },


];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "社区ID",
    field: 'communityId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "账期月份",
    field: 'month',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "起始日期",
    field: 'startData',
    component: 'DatePicker',
    //colProps: {span: 6},
  },
  {
    label: "进度",
    field: 'progress',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "progress_type"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '报表名称',
    field: 'reportName',
    component: 'Input',
  },
  {
    label: '社区ID',
    field: 'communityId',
    component: 'Input',
  },
  {
    label: '账期月份',
    field: 'month',
    component: 'Input',
  },
  {
    label: '起始日期',
    field: 'startData',
    component: 'DatePicker',
  },
  {
    label: '结束日期',
    field: 'endData',
    component: 'DatePicker',
  },
  {
    label: '推送人',
    field: 'pusher',
    component: 'Input',
  },
  {
    label: '推送时间',
    field: 'pushData',
    component: 'DatePicker',
  },
  {
    label: '发起人',
    field: 'promoter',
    component: 'Input',
  },
  {
    label: '发起时间',
    field: 'promoteTime',
    component: 'Input',
  },
  {
    label: '进度',
    field: 'progress',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "progress_type"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  reportName: {title: '报表名称',order: 0,view: 'text', type: 'string',},
  communityId: {title: '社区ID',order: 1,view: 'text', type: 'string',},
  month: {title: '账期月份',order: 2,view: 'text', type: 'string',},
  startData: {title: '起始日期',order: 3,view: 'date', type: 'string',},
  endData: {title: '结束日期',order: 4,view: 'date', type: 'string',},
  pusher: {title: '推送人',order: 5,view: 'text', type: 'string',},
  pushData: {title: '推送时间',order: 6,view: 'date', type: 'string',},
  promoter: {title: '发起人',order: 7,view: 'text', type: 'string',},
  promoteTime: {title: '发起时间',order: 8,view: 'text', type: 'string',},
  progress: {title: '进度',order: 9,view: 'list', type: 'string',dictCode: 'progress_type',},
};
